package com.itheima.mapper;

import com.itheima.pojo.Setmeal;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {

    /**
     * 新增套餐
     * @param setmeal
     */
    void addSetmeal(Setmeal setmeal);
    /**
     * 新增套餐和检查组关系
     * @param code
     * @param checkgroupIds
     */
    void addSetmealAndCheckGroup(String code, List<Integer> checkgroupIds);

    /**
     * 删除套餐和检查组关系
     * @param id
     */
    @Delete("delete from t_setmeal_checkgroup where setmeal_id = #{id}")
    void deleteSetmealAndCheckGroup(Integer id);
    /**
     * 删除套餐
     * @param id
     */
    @Delete("delete from t_setmeal where id = #{id}")
    void deleteById(Integer id);


    /**
     * 根据id查询套餐
     * @param id
     * @return
     */
    @Select("select * from t_setmeal where id = #{id}")
    Setmeal findById(Integer id);

    List<Setmeal> pageList(Integer currentPage, Integer pageSize, String queryString);
}
